const app = getApp()
const request = require('../../utils/https.js')
import util from '../../utils/util.js';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    orderId: 0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    const that = this;
    that.setData({
      orderId: options.orderid,
      orderStates: options.orderStates
    })
    request._get(getApp().Api_url + 'order/detail', {
      orderId: options.orderid
    }, function (res) {

      if (res.data.errMsg == 'OK') {
        let orderData = res.data.data;
        console.log('orderData===>', orderData)
        that.setData({
          orderData: orderData
        })
      }
    }, function () {})
  },
  //查看详情页
  goOrder(e) {
    const that = this;
    let goodsId = e.currentTarget.dataset.goodsid;
    /*     let userId = wx.getStorageSync("userId");
         if (userId == '' || userId == null || userId == 'undefined') {
          wx.navigateTo({
            url: '/pages/login/login',
          })
          return;
        } */
    wx.navigateTo({
      url: '/pages/gift_details/gift_details?goodsId=' + goodsId + '&show=0'
    })
  },
  //售后
  /*   goToApply(e) {
      const subsId = e.currentTarget.dataset.subsid
      wx.navigateTo({
        url: '/pages/after_sales/after_sales?subsId=' + subsId,
      })
    }, */
  goToApply(e) {
    wx.navigateTo({
      url: '/pages/return/return'
    })
  },

  //查看售后详情
  goToAfterSales(e) {
    const orderid = e.currentTarget.dataset.subsid
    wx.navigateTo({
      url: '/pages/after_type/after_type?orderid=' + orderid,
    })
  },

})